package org.stwy.lease.contract;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.stwy.pro.asset.AssetEntity;
import org.stwy.pro.asset.AssetService;

import com.rap.common.persistence.IBaseDAO;
import com.rap.common.exception.ServiceException;
import com.rap.common.service.BaseServiceImpl;

/**
 * 合同 服务类
 */
/**
*版权信息 (c) RAP 保留所有权利.
*@author Rap.Codegen
*@Team RAP Team
*@Date 2015-4-17 20:48:15
*<p></p>
*
*@参与人：Rap.Codegen
*/
 
@Service
@Transactional(rollbackFor=Exception.class)
public class ContractAssetService extends BaseServiceImpl<ContractAssetEntity, String> {

	@Autowired
	private ContractAssetDAO dao;

	@Override
	protected IBaseDAO<ContractAssetEntity, String> getDAO() {
		return dao;
	}

	public List<ContractAssetEntity> findByContractIds(String[] contractIds) {
		List<ContractAssetEntity> list = new ArrayList<ContractAssetEntity>();
		for(String contractId :contractIds){
			list.addAll(findByContractId(contractId));
		}
		return list;
	}
	
	public List<ContractAssetEntity> findByContractId(String contractId) {
		return dao.findByContractId(contractId);
	}
	
}
